// 3. 创建带参数的构造函数工厂实例方法
class TestClass {
  // 准备类
  public name: string
  public classno: number
  constructor(name: string, classno: number) {
    this.name = name
    this.classno = classno
  }
  eat() {
    console.log('姓名为: ' + this.name, this.classno)
  }
}
type Constructor<T> = new (...args: any[]) => T // 构造函数类型的通用类型

type ConstructorParametersType1<T extends new (...args: any[]) => any> =
  T extends new (...args: infer P) => any ? P : never

let constructorParameters: ConstructorParametersType1<typeof TestClass>

function createInstance<T>(constructor: Constructor<T>, ...args: any[]) {
  return new constructor(args[0], args[1])
}

createInstance<TestClass>(TestClass, 'wagw', 124124124).eat()
// 此时还有潜在的问题
export {}
